package com.example.demo.Mapper;


import com.example.demo.entity.UserInfo;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
@Mapper
public interface UserInfoMapper {
    @Select("select * from client")
    List<UserInfo> getUsersInfo();

    @Insert("insert into client(client_id,client_name,tel,age,email,client_password) values(#{client_id},#{client_name},#{tel},#{age},#{email},#{client_password})")
    public int addUserInfo(int client_id,String client_name,String tel,int age,String email,String client_password);

    @Update("update client " +
            "set client_name=#{client_name},tel=#{tel},age=#{age},email=#{email},client_password=#{client_password} where client_id=#{client_id}")
    public int updateUserInfo(int client_id,String client_name,String tel,int age,String email,String client_password);

    @Select("select * from client where client_name = #{client_name}")
    UserInfo getUserInfoByUsername(String client_name);

    @Delete("delect * from client where clinet_id=#{client_id}")
    public int delUserInfo(int client_id);
}

